<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
%>
<html>
<head>
    <title>个人中心-首页</title>
    <link rel="stylesheet" href="<%=path%>/web/userinfo/css/homePage.css">
</head>
<body onload="startClock()" onunload="stopClock()">
<div class="main">
    <div class="main-head">
        <h3>欢迎进入个人中心</h3><span>系统当前时间：</span><div id="show"></div>
    </div>
    <div class="main-body">
        <div class="single-notuser"></div>
        <div class="single-earnings">
            <div class="earnings-icon">
            </div>
            <h4>发表日志</h4>
            <h2>${requestScope.journalCount}篇</h2>
            <p>万码第一帅比--王修全！</p>
        </div>
        <div class="single-earnings">
            <div class="earnings-icon">
            </div>
            <h4>发布任务</h4>
            <h2>${requestScope.taskCount}次</h2>
            <p>万码第一帅比--王修全！</p>
        </div>
        <div class="single-earnings">
            <div class="earnings-icon">
            </div>
            <h4>寻亲启事</h4>
            <h2>${requestScope.InformationCount}篇</h2>
            <p>万码第一帅比--王修全！</p>
        </div>
        <div class="single-earnings">
            <div class="earnings-icon">
            </div>
            <h4>我的关注</h4>
            <h2>${requestScope.attentionCount}个</h2>
            <p>万码第一帅比--王修全！</p>
        </div>
        <div class="log-info">
            <div class="log-count">
                <p>登录次数</p>
                <p>${sessionScope.userinfo.loginCount}次</p>
            </div>
            <h3 style="font-weight:bold">最后登录IP</h3>
            <h2 style="color:blue">${sessionScope.userinfo.ip}</h2>
            <p>最后登录时间</p>
            <p>
                <fmt:formatDate value="${sessionScope.userinfo.lastLoginTime}" pattern="yyyy-MM-dd"/>
            </p>
        </div>
        <div class="log-info">
            <h3>
                继续浏览我的信息<span><a target="_self" href="<%=path %>/web/userinfo/details">配置我的个人信息</a></span>
            </h3>
            <p>去个人信息留下签名吧！</p><br/>
            <p><a href="/course/list.html"></a></p>
        </div>

    </div>
</div>
</body>
<script src="<%=path %>/web/index/js/jquery.min.js"></script>
</html>

<script>
    var timer=null;
    function displayClock(num){//num是传入的startClock中的动态值
        if(num<10){
            return "0"+num;
        }
        else{
            return num;
        }
    }
    //停止计时
    function stopClock(){
        clearTimeout(timer);
    }
    //开始计时
    function startClock(){
        var time =new Date();
        var hours=displayClock(time.getHours())+":";
        var minutes=displayClock(time.getMinutes())+":";
        var seconds=displayClock(time.getSeconds());
        //显示时间
        show.innerHTML=hours+minutes+seconds;//在id为show的块区域显示
        timer=setTimeout("startClock()",1000);//延时器
    }
</script>